package com.share.admin.config;

import com.theokanning.openai.service.OpenAiService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.time.Duration;

@Slf4j
@Configuration
public class ChatGptConfig {
    //chatgpt注册后的账号创建的访问token
    public static final String OPEN_AI_TOKEN = "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";
    public static final String DEFAULT_MODEL = "text-davinci-003";
    public static final Double DEFAULT_TEMPERATURE = 0.2d;

    @Bean
    public OpenAiService openAiService() {
        OpenAiService service = new OpenAiService(OPEN_AI_TOKEN, Duration.ofMinutes(1l));
        return service;
    }
}